4D Chart v13

Locations for 4D Chart

Home

 
4D Chart v13
Locations for 4D Chart

Locations for 4D Chart  


 

 

You can work with 4D Chart in the following locations:

  • 4D Chart areas on forms,
  • 4D Chart plug-in windows,
  • 4D Chart offscreen areas.

This section describes how to create those locations in your databases.

You can place 4D Chart in any form. Usually you place 4D Chart on an input form so that you can work with documents. You can place 4D Chart in an output form to display and print information as well. 4D Chart can use the entire form, or it can share space with fields and other form objects.

You can create areas of all sizes. However, if the size of the area is less than 300 x 150 pixels, it will appear as a button whose title is the name of the area variable. The user can click on this button to display the area in full-screen mode. This mechanism can be disabled using the CT SET ENTERABLE command.

You use a Plug-in Area object to create a 4D Chart area on a form. A Plug-in Area object is one of several types of active objects in 4D, such as buttons, enterable areas, and scrollable areas. For complete information about Plug-in Area objects, see the 4D Design Reference and the 4D Language Reference manuals.

When you need to refer to a document on a form, use the object name that you used when you created the Plug-in Area object.

For more information about placing 4D Chart areas in a form, refer to the section Referring to 4D Chart Documents.

You use the Open external window function to open a plug-in window and display an empty 4D Chart document in it. For more information about this function, refer to the 4D Language Reference manual.

Open external window opens a new window, displays the 4D plug-in area supported by the plugInArea parameter, and returns the ID number for the area.

For 4D Chart, the plugInArea parameter is written as follows: _4D Chart. Do not omit the leading underscore and the space between “4D” and “Chart.” Both of these conventions are necessary syntax elements.

Open external window creates modeless windows, allowing you to have several active windows open simultaneously. The command does not wait for user input, so you can have several active windows open at once. You can click between each window and edit the one in front. If the window type has a title bar, a Control-menu box (Windows) or a Close Box (Macintosh) will be added to enable the user to close the window.

To close a plug-in window programmatically, pass the variable returned by Open external window to the 4D CLOSE WINDOW command.

Example  

The following is an example of the use of Open external window. This statement opens a plug-in window and displays an empty 4D Chart document.

 vChart:=Open external window(50;50;350;450;8;"Profit Margin Graph";"_4D Chart")

Subsequently, you would use vChart whenever you need to specify the area for that document. For example:

 CT GET DEPTH(vChart;vObject;vHoriz;vVert)

An offscreen area is stored in memory and is not visible to the programmer or user. You can use an offscreen area to make modifications to a document before the user views it or to save the document so that the user can revert to the original, if necessary.

4D Chart operations can be performed more quickly in an offscreen area because the screen does not have to be redrawn.

You can use the CT New offscreen area function to create an offscreen area. You can use the CT PICTURE TO AREA command to place a Picture field (which can contain a 4D Chart area) in a 4D Chart area (which can be an offscreen area). For a complete explanation of these commands, refer to the commands in the Area theme.

Remember to delete the offscreen area after you are done with it to free the memory it uses. 4D will display an error message when you close the database if you have not cleared all offscreen areas.

Example  

When placed in a project method, the code in the following example creates an offscreen area for saving a document. Using a button on a form, you can allow the user to revert to the original saved document.

 Area:=CT New offscreen area
 QUERY([Sales];[Sales]CustID=vCustID)
 If(Records in selection([Sales]=1)
    CT PICTURE TO AREA(Area;[Sales]Profits_)
  `Store the graph in the offscreen area
    MODIFY RECORD([Sales])
  `Modify the Sales record
    CT DELETE OFFSCREEN AREA(Area)
  `Free the memory used by the offscreen area
 End if

Create a button on the input form and assign it the following code:

 Profits:=CT Area to picture(Area;-2)
  `Places the offscreen area that contains the original document into the plug-in
  `area contained in the Profits form.

 
PROPERTIES 

Product: 4D Chart
Theme: Introduction to the language

 
SEE ALSO 

Referring to 4D Chart Documents